@extends('Admin.index')

@section('css')
    <style>
        a {
            color: #337ab7;
        }
    </style>

@endsection

@section('content')

    <div class="app-third-sidebar">
        <nav class="ui-nav " style="display: block;">
            <ul>
                <li>
                    <a href="javascript:void(0);"><span>会员管理</span></a>
                </li>
            </ul>
        </nav>
    </div>

    <div id="wrapper">

        <div class="row">
            <div class="col-lg-12">

                <div class="row">

                    <div class="col-md-2">
                        <a class="btn btn-success" role="button" onclick="user.export()">导出EXCEL</a>
                    </div>

                    <div class="col-md-10">
                        <form class="form-inline" id="search-form" onsubmit="return false;">

                            <div class="form-group">
                                <input type="text" style="width: 150px;" class="form-control name" name="name"  placeholder="会员昵称">
                            </div>

                            <div class="form-group">
                                <input type="text" style="width: 130px;" class="form-control join_time" name="startDateTime" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD'})" placeholder="请选择开始时间">&nbsp;&nbsp;~&nbsp;
                            </div>

                            <div class="form-group">
                                <input type="text" style="width: 130px;"  class="form-control join_time" name="endDateTime" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD'})" placeholder="请选择结束时间">
                            </div>
                            <div class="form-group">

                            </div>
                            <div class="form-group">
                                <input type="text" style="width: 100px;" class="form-control join_time" name="startDate" placeholder="请输入PK次数">&nbsp;&nbsp;~&nbsp;
                            </div>

                            <div class="form-group">
                                <input type="text" style="width: 100px;"  class="form-control join_time" name="endDate"  placeholder="请输入PK次数">
                            </div>

                            <div class="input-group">
                                <span class="input-group-btn">
                                    <button class="btn btn-default" name="search" type="button">查询</button>
                                    <button class="btn btn-warning" name="to-reset" type="button">重置</button>
                                </span>
                            </div>
                        </form>
                    </div>

                </div>
            </div>
        </div>
        <br>

        <div class="row">
            <div class="col-lg-12">
                <table id="table"></table>
            </div>
        </div>
    </div>

@endsection

@section('js')

    <script>

        var bootstrap_table_ajax_url = '/admin/user/search';

        $('#table').bootstrapTable({
            classes: 'table table-hover', //bootstrap的表格样式
            sidePagination: 'server', //获取数据方式【从服务器获取数据】
            pagination: true, //分页
            height: $(window).height() - 200, //表格高度
            pageNumber: 1, //页码【第X页】
            pageSize: 10, //每页显示多少条数据
            queryParamsType: 'limit',
            queryParams: function (params) {
                var dt = E.getFormValues('search-form');
                $.extend(params, dt);
                return params;
            },
            url: bootstrap_table_ajax_url,//ajax链接
            sortName: 'iSeqId', //排序字段
            sortOrder: 'DESC',//排序方式
            columns: [ //字段
                { title: '序号', field: 'id', align: 'center'},
                { title: '注册时间', field: 'iRegistTime', align: 'center'},
                { title: '微信昵称', field: 'sUserName', align: 'center'},
                { title: '微信头像', field: 'sUserImage', align: 'center'},
                { title: '上次签到时间', field: 'dtModifyTime', align: 'center'},
                { title: '登录次数', field: 'iAllPk', align: 'center'},
                { title: '胜率',  field: 'rate', align: 'center' },
                { title: '总场次',  field: 'iAll', align: 'center' },
                { title: '签到得金币数',  field: 'signgold', align: 'center' },
                { title: '输赢金币数',  field: 'pkgold', align: 'center' },
                { title: '兑换金币数',  field: 'exchangegold', align: 'center' },
                { title: '当前金币数',  field: 'iWinAll', align: 'center' }
            ]
        });

        var user = {

            //导出
            export:function () {
                var searchForm = document.getElementById('search-form');
                searchForm.action = '/admin/excel/export/1';
                searchForm.submit();
            },

            //当前金币数
            wing:function (id) {
                layer.open({
                    title: false,
                    type: 2 ,
                    area: ['100%', '100%'],
                    offset: '0px' ,
                    content: '/admin/statistics/details/'+ id,
                    closeBtn: false,
                    scrollbar: false
                });
            },
            //兑换豆数
            change:function (id) {
                layer.open({
                    title: false,
                    type: 2 ,
                    area: ['100%', '100%'],
                    offset: '0px' ,
                    content: '/admin/statistics/change/'+ id,
                    closeBtn: false,
                    scrollbar: false
                });
            },//兑换豆数
            allChange:function (id) {
                layer.open({
                    title: false,
                    type: 2 ,
                    area: ['100%', '100%'],
                    offset: '0px' ,
                    content: '/admin/statistics/change/'+ id,
                    closeBtn: false,
                    scrollbar: false
                });
            }

        }
    </script>

@endsection
